package com.osfw.activiti.service.process;


import com.osfw.activiti.domain.ProcessApplyInfo;
import com.osfw.activiti.domain.ProcessApproval;
import com.osfw.activiti.domain.ProcessTaskInfo;
import com.osfw.activiti.entity.history.ActHiProcinst;
import com.osfw.activiti.entity.history.ActHiTaskinst;
import com.osfw.activiti.entity.running.ActRuTask;
import com.osfw.system.entity.manage.SysUser;

import java.util.List;
import java.util.Map;

/**
 * 流程综合业务 服务层
 */
public interface IProcessService {

    /**
     * 提交申请信息
     *
     * @param applyInfo 申请信息
     */
    ActHiProcinst apply(ProcessApplyInfo applyInfo);

    /**
     * 完成审批任务
     *
     * @param approval 审批信息
     */
    boolean complete(ProcessApproval approval, SysUser sysUser);

    boolean delegate(String instanceId, String userId, String delegateToUser);

    boolean cancel(String instanceId, String deleteReason);

    boolean suspendOrActive(String instanceId, String suspendState);

    List<ProcessApplyInfo> selectApplyList(ProcessApplyInfo applyInfo, SysUser sysUser);

    List<ProcessTaskInfo> selectTodoTasks(ProcessTaskInfo taskInfo, SysUser sysUser);
    boolean handleTodoTask(ProcessTaskInfo taskInfo);

    List<ProcessTaskInfo> selectEntrustTasks(ProcessTaskInfo taskInfo, SysUser sysUser);

    List<ProcessTaskInfo> selectDoneTasks(ProcessTaskInfo taskInfo, SysUser sysUser);

    List<ProcessTaskInfo> selectCompletedTasks(ProcessTaskInfo taskInfo, SysUser sysUser);

    boolean cancelApplyList(String ids);
    boolean refuseTodoTask(Long taskId);
    boolean entrustTodoTask(Long taskId, Long userId);
    boolean signTodoTask(Long taskId, Long userId);

    ProcessTaskInfo getDoneTaskInfo(Long taskId);

    /**
     * 判断是否是第一个审批节点
     *
     * @param procInstId 流程实例ID
     */
    boolean checkIsFirstNode(Long procInstId);

    /**
     * 判断是否可以撤回申请
     *
     * @param procInstId 流程实例ID
     */
    boolean checkWhetherCanCancel(Long procInstId);

}
